<template>
  <div class="app-container">
    <el-card class="box-card">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true"  label-width="70px">
      <el-form-item label="问题名称" prop="issueName">
        <el-select
          v-model="queryParams.issueName"
          placeholder="请选择问题名称"
          clearable
        >
          <el-option
            v-for="dict in dict.type.yh_issue_name"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
<!--        <el-form-item label="统一社会信用代码" prop="creditCodes" >
          <el-input
            v-model="queryParams.creditCodes"
            placeholder="请输入统一社会信用代码"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>-->
      <el-form-item label="问题属性" prop="issueType">
        <el-select
          v-model="queryParams.issueType"
          placeholder="请选择问题属性"
          clearable
        >
          <el-option
            v-for="dict in dict.type.yh_issue_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>


      <el-form-item label="问题编号" prop="questionNumber">
        <el-select
          v-model="queryParams.questionNumber"
          placeholder="请选择问题编号"
          clearable
        >
          <el-option
            v-for="dict in dict.type.yh_question_number"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>


<!--        <el-form-item label="计划归零时间" prop="plannedZeroTime" v-show="showSearch">
          <el-date-picker clearable
                          v-model="queryParams.plannedZeroTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择计划归零时间">
          </el-date-picker>
        </el-form-item>-->

      <el-form-item label="问题模式" prop="problemModel" >
        <el-select
          v-model="queryParams.problemModel"
          placeholder="请选择问题模式"
          clearable
        >
          <el-option
            v-for="dict in dict.type.yh_problem_model"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="监管方式" prop="supervisionMethod"  v-show="showSearch">
        <el-input
          v-model="queryParams.supervisionMethod"
          placeholder="请输入问题名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

<!--        <el-form-item label="发现问题日期" prop="discoveryDate" v-show="showSearch">
          <el-date-picker clearable
                          v-model="queryParams.discoveryDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请输入发现问题日期">
          </el-date-picker>
        </el-form-item>-->

<!--      <el-form-item label="质量体系问题涉及过程" prop="involveProcess">
        <el-input
          v-model="queryParams.involveProcess"
          placeholder="请输入质量体系问题涉及过程"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->







<!--      <el-form-item label="问题事实描述" prop="problemFactDescription">
        <el-input
          v-model="queryParams.problemFactDescription"
          placeholder="请输入问题事实描述"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
<!--      <el-form-item label="问题原因详述" prop="causeDetails">
        <el-input
          v-model="queryParams.causeDetails"
          placeholder="请输入问题原因详述"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
<!--      <el-form-item label="解决措施落实情况" prop="settlementMeasures">
        <el-input
          v-model="queryParams.settlementMeasures"
          placeholder="请输入解决措施落实情况"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->

<!--      <el-form-item label="问题直接原因类别" prop="directCauseCategory">
        <el-input
          v-model="queryParams.directCauseCategory"
          placeholder="请输入问题直接原因类别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
<!--      <el-form-item label="问题发现方式" prop="issueDiscovery" v-show="showSearch">
        <el-select
          v-model="queryParams.issueDiscovery"
          placeholder="请选择问题发现方式"
          clearable
        >
          <el-option
            v-for="dict in dict.type.yh_issue_discovery"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="承制单位性质" prop="contractorUnitNature" v-show="showSearch">
        <el-input
          v-model="queryParams.contractorUnitNature"
          placeholder="请输入承制单位性质"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
     <el-form-item label="承制单位代号" prop="contractorUnitCode" v-show="showSearch">
        <el-input
          v-model="queryParams.contractorUnitCode"
          placeholder="请输入承制单位代号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
      <!--   <el-form-item label="承制单位所属部门" prop="contractorDepartment">
          <el-input
            v-model="queryParams.contractorDepartment"
            placeholder="请输入承制单位所属部门"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>-->


<!--      <el-form-item label="监管JDB局" prop="representativeBureau" v-show="showSearch">
        <el-input
          v-model="queryParams.representativeBureau"
          placeholder="请输入监管JDB局"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->

<!--      <el-form-item label="问题归零情况" prop="problemZero">
        <el-input
          v-model="queryParams.problemZero"
          placeholder="请输入问题归零情况"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
<!--      <el-form-item label="创建者" prop="createBy">
        <el-input
          v-model="queryParams.createBy"
          placeholder="请输入创建者"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker clearable
          v-model="queryParams.createTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="更新者" prop="updateBy">
        <el-input
          v-model="queryParams.updateBy"
          placeholder="请输入更新者"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="更新时间" prop="updateTime">
        <el-date-picker clearable
          v-model="queryParams.updateTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择更新时间">
        </el-date-picker>
      </el-form-item>-->

      <br/>
      <div style="text-align: right;">
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </div>
      <br/>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['dr:dailyquality:add']"
        >新增</el-button>
      </el-col>
<!--      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['dr:dailyquality:edit']"
        >修改</el-button>
      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['dr:dailyquality:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['dr:dailyquality:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="dailyqualityList" border @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column
        v-if="columns[0].visible"
        label="序号"
        type="index"
        width="50"
        align="center">
        <template scope="scope">
          <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
        </template>
      </el-table-column>
      <el-table-column label="问题名称" align="center" prop="issueName" v-if="columns[1].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.yh_issue_name" :value="scope.row.issueName"/>
      </template>
      </el-table-column>
      <el-table-column label="问题属性" align="center" prop="issueType" v-if="columns[2].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.yh_issue_type" :value="scope.row.issueType"/>
      </template>
      </el-table-column>
      <el-table-column label="问题发现方式" align="center" prop="issueDiscovery" v-if="columns[3].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.yh_issue_discovery" :value="scope.row.issueDiscovery"/>
      </template>
      </el-table-column>
      <el-table-column label="统一社会信用代码" align="center" prop="creditCodes" v-if="columns[4].visible"/>
      <el-table-column label="承制单位性质" align="center" prop="contractorUnitNature" v-if="columns[5].visible"/>
      <el-table-column label="监管方式" align="center" prop="supervisionMethod" v-if="columns[6].visible"/>
      <el-table-column label="发现问题JS代表" align="center" prop="foundProblems" v-if="columns[7].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.yh_found_problems" :value="scope.row.foundProblems"/>
      </template>
      </el-table-column>
      <el-table-column label="计划归零时间" align="center" prop="plannedZeroTime" width="180"v-if="columns[8].visible">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.plannedZeroTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="监管JDB室" align="center" prop="representativeOffice" v-if="columns[18].visible">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.yh_representative_office" :value="scope.row.representativeOffice"/>
        </template>
      </el-table-column>
      <el-table-column label="处理牵头组织单位" align="center" prop="dealWithOrganization" v-if="columns[10].visible"/>
      <el-table-column label="问题编号" align="center" prop="questionNumber" v-if="columns[11].visible">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.yh_question_number" :value="scope.row.questionNumber"/>
        </template>
      </el-table-column>
      <el-table-column label="问题直接原因类别" align="center" prop="directCauseCategory" v-if="columns[12].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.yh_direct_cause_category" :value="scope.row.directCauseCategory"/>
      </template>
      </el-table-column>
      <el-table-column label="问题模式" align="center" prop="problemModel" v-if="columns[13].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.yh_problem_model" :value="scope.row.problemModel"/>
      </template>
      </el-table-column>
      <el-table-column label="承制单位代号" align="center" prop="contractorUnitCode" v-if="columns[14].visible"/>
      <el-table-column label="承制单位所属部门" align="center" prop="contractorDepartment" v-if="columns[15].visible"/>
      <el-table-column label="JDBJJ印章序号" align="center" prop="representativeOfficeSealNumber" v-if="columns[16].visible">
      <template slot-scope="scope">
        <dict-tag :options="dict.type.yh_representative_office_seal_number" :value="scope.row.representativeOfficeSealNumber"/>
      </template>
      </el-table-column>
      <el-table-column label="发现问题日期" align="center" prop="discoveryDate" v-if="columns[17].visible"/>
      <el-table-column label="监管JDB局" align="center" prop="representativeBureau" v-if="columns[18].visible"/>
      <el-table-column label="问题处理JS代表" align="center" prop="problemSolving" v-if="columns[19].visible"/>
      <el-table-column label="发现问题日期" align="center" prop="discoveryDate" v-if="columns[20].visible"/>
        <el-table-column label="质量问题级别" align="center" prop="problemLevel" v-if="columns[21].visible">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.jibie" :value="scope.row.problemLevel"/>
          </template>
        </el-table-column>
      <el-table-column label="内外场区别" align="center" prop="differenceFields" v-if="columns[22].visible">
        <dict-tag  :options="dict.type.inout" :value="form.differenceFields" />
      </el-table-column>
      <el-table-column label="是否拉条挂账" align="center" prop="hangAccount" v-if="columns[23].visible">
        <template slot-scope="scope">
        <dict-tag :options="dict.type.latiao" :value="scope.row.hangAccount"/>
        </template>
      </el-table-column>
      <el-table-column label="是否归零" align="center" prop="returnZero" v-if="columns[24].visible">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.guiling" :value="scope.row.returnZero"/>
        </template>
      </el-table-column>
      <el-table-column label="责任人" align="center" prop="personLiable" v-if="columns[25].visible"/>
      <el-table-column label="责任单位" align="center" prop="responsibleUnit" v-if="columns[26].visible"/>

<!--      <el-table-column label="质量体系问题涉及过程" align="center" prop="involveProcess" v-if="columns[4].visible"/>-->





<!--      <el-table-column label="问题事实描述" align="center" prop="problemFactDescription" />
      <el-table-column label="问题原因详述" align="center" prop="causeDetails" />
      <el-table-column label="解决措施落实情况" align="center" prop="settlementMeasures" />-->

<!--      <el-table-column label="创建者" align="center" prop="createBy" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新者" align="center" prop="updateBy" />
      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>-->
      <el-table-column label="备注" align="center" prop="remark"v-if="columns[27].visible" />
<!--      <el-table-column label="备注1" align="center" prop="note1" />
      <el-table-column label="备注2" align="center" prop="note2" />
      <el-table-column label="备注3" align="center" prop="note3" />
      <el-table-column label="备注4" align="center" prop="note4" />
      <el-table-column label="备注5" align="center" prop="note5" />
      <el-table-column label="备注6" align="center" prop="note6" />
      <el-table-column label="备注7" align="center" prop="note7" />
      <el-table-column label="备注8" align="center" prop="note8" />
      <el-table-column label="备注9" align="center" prop="note9" />
      <el-table-column label="备注10" align="center" prop="note10" />-->
      <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['dr:dailyquality:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            @click="handleDelete(scope.row)"
            v-hasPermi="['dr:dailyquality:remove']"
          >删除</el-button>
          <el-button
            size="mini"
            type="text"
            @click="handleView(scope.row)"
            v-hasPermi="['dr:dailyquality:query']"
          >详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    </el-card>
    <!-- 添加或修改日常质量问题报对话框 -->
    <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="1300px" append-to-body>
      <el-form label-position="right" ref="form" :model="form" :rules="rules" label-width="170px">
            <el-row>
              <el-col :span="8">
                <el-form-item label="问题名称" prop="issueName">
                  <el-select
                    style="width: 100%"
                    v-model="form.issueName"
                    placeholder="请选择问题名称"
                    clearable
                  >
                    <el-option
                      v-for="dict in dict.type.yh_issue_name"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="问题属性" prop="issueType">
                  <el-select
                    style="width: 100%"
                    v-model="form.issueType"
                    placeholder="请选择问题属性"
                    clearable
                  >
                    <el-option
                      v-for="dict in dict.type.yh_issue_type"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="问题发现方式" prop="issueDiscovery">
                  <el-select
                    style="width: 100%"
                    v-model="form.issueDiscovery"
                    placeholder="请选择问题发现方式"
                    clearable
                  >
                    <el-option
                      v-for="dict in dict.type.yh_issue_discovery"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="质量体系问题涉及过程" prop="involveProcess">
                  <el-input v-model="form.involveProcess" placeholder="请输入质量体系问题涉及过程" style="width: 100%"/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="统一社会信用代码" prop="creditCodes">
                  <el-input v-model="form.creditCodes" placeholder="请输入统一社会信用代码"style="width: 100%"/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="承制单位性质" prop="contractorUnitNature">
                  <el-input v-model="form.contractorUnitNature" placeholder="请输入承制单位性质" style="width: 100%"/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="监管方式" prop="supervisionMethod">
                  <el-input v-model="form.supervisionMethod" placeholder="请输入监管方式" style="width: 100%"/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="发现问题JS代表" prop="foundProblems">
                  <el-select
                    style="width: 100%"
                    v-model="form.foundProblems"
                    placeholder="请选择发现问题JS代表"
                    clearable
                  >
                    <el-option
                      v-for="dict in dict.type.yh_found_problems"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="计划归零时间" prop="plannedZeroTime">
                  <el-date-picker clearable
                                  v-model="form.plannedZeroTime"
                                  type="date"
                                  value-format="yyyy-MM-dd"
                                  placeholder="请选择计划归零时间"
                                  style="width: 100%">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="监管JDB室" prop="representativeOffice">
                  <el-select v-model="form.representativeOffice" placeholder="请选择部门" style="width:100%">
                    <el-option
                      v-for="dict in dict.type.yh_representative_office"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="处理牵头组织单位" prop="dealWithOrganization">
                  <el-input v-model="form.dealWithOrganization" placeholder="请输入处理牵头组织单位" style="width: 100%"/>
                </el-form-item>
              </el-col>
            </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="问题事实描述">
              <el-input v-model="form.problemFactDescription" type="textarea"style="width: 100%"/>
            </el-form-item>
          </el-col>
        </el-row> <el-row>
        <el-col :span="24">
          <el-form-item label="问题原因详述">
            <el-input v-model="form.causeDetails" type="textarea" style="width: 100%"/>
          </el-form-item>
        </el-col>
      </el-row>

        <el-row>
        <el-col :span="24">
          <el-form-item label="解决措施落实情况">
            <el-input v-model="form.settlementMeasures" type="textarea" style="width: 100%"/>
          </el-form-item>
        </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="问题编号" prop="questionNumber">
              <el-select
                style="width: 100%"
                v-model="form.questionNumber"
                placeholder="请选择问题编号"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.yh_question_number"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="问题直接原因类别" prop="directCauseCategory">
              <el-select
                style="width: 100%"
                v-model="form.directCauseCategory"
                placeholder="请选择问题直接原因类别"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.yh_direct_cause_category"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="问题模式" prop="problemModel" >
              <el-select
                style="width: 100%"
                v-model="form.problemModel"
                placeholder="请选择问题模式"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.yh_problem_model"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="承制单位代号" prop="contractorUnitCode">
              <el-input v-model="form.contractorUnitCode" placeholder="请输入承制单位代号" style="width: 100%"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="承制单位所属部门" prop="contractorDepartment">
              <el-input v-model="form.contractorDepartment" placeholder="请输入承制单位所属部门" style="width: 100%"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="JDBJJ印章序号" prop="representativeOfficeSealNumber" >
              <el-select
                style="width: 100%"
                v-model="form.representativeOfficeSealNumber"
                placeholder="请选择JDBJJ印章序号"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.yh_representative_office_seal_number"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="发现问题日期" prop="discoveryDate">
              <el-date-picker clearable
                              v-model="form.discoveryDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择发现问题日期"
                              style="width: 100%">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="监管JDB局" prop="representativeBureau">
              <el-input v-model="form.representativeBureau" placeholder="请输入监管JDB局" style="width: 100%"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="问题处理JS代表" prop="problemSolving">
              <el-input v-model="form.problemSolving" placeholder="请输入问题处理JS代表" style="width: 100%"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="问题归零情况" prop="problemZero">
              <el-select
                style="width: 100%"
                v-model="form.problemZero"
                placeholder="请选择问题归零情况"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.yh_problem_zero"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否拉条挂账" prop="hangAccount" >
              <el-select
                style="width: 100%"
                v-model="form.hangAccount"
                placeholder="请选择是否拉条挂账"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.latiao"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="内外场区别" prop="differenceFields">
              <el-select style="width: 100%" v-model="form.differenceFields" placeholder="请选择内外场区别" >
                <el-option
                  v-for="dict in dict.type.inout"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="质量问题级别" prop="problemLevel">
              <el-select style="width: 100%" v-model="form.problemLevel" placeholder="请选择质量问题级别" >
                <el-option
                  v-for="dict in dict.type.jibie"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="责任人" prop="personLiable">
              <el-input v-model="form.personLiable" placeholder="请输入责任人" style="width: 100%"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="责任单位" prop="responsibleUnit">
              <el-input v-model="form.responsibleUnit" placeholder="请输入责任单位" style="width: 100%"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" style="width: 100%"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 日常质量问题报详情对话框 -->
  </div>
</template>
<style>
.ql-toolbar.ql-snow {
  text-align: left;
  border: 1px solid #ccc;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
  padding: 8px;
  /* float: none; */
}
.el-header, .el-footer {
  background-color: #FFFFFF;
  color: #333;
  text-align: left;
  line-height: 60px;
  font-style: oblique;

}

.el-aside {
  background-color: #D3DCE6;
  color: #333;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #FFFFFF;
  color: #333;
  text-align: center;
  line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

/*对话框标题样式*/
.el-dialog__title{
  /*color: #1ab394;*/
  font-weight: bold;
  font-size: 25px;
}
</style>
<script>
import { listDailyquality, getDailyquality, delDailyquality, addDailyquality, updateDailyquality } from "@/api/module/dr/dailyquality";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import watermark from "watermark-dom";
export default {
  name: "Dailyquality",
  components: { Treeselect },
  dicts: ['yh_issue_name','yh_issue_type','yh_issue_discovery','yh_question_number','yh_problem_model','yh_found_problems','yh_direct_cause_category','yh_representative_office_seal_number','yh_problem_zero'
  ,'jibie','inout','latiao','guiling','yh_representative_office'],
  mounted() {
    // 加载水印
    const username = this.$store.state.user.name;
    watermark.load({ watermark_txt: "  "   });
  },
  data() {
    return {

      /** 关闭按钮*/
      close(){
        this.open1=false;
      },
      columns: [
        {key: 0, label: `id`, visible: true},
        {key: 1, label: `问题名称`, visible: true},
        {key: 2, label: `问题属性`, visible: true},
        {key: 3, label: `问题发现方式`, visible: false},
        {key: 4, label: `统一社会信用代码`, visible: false},
        {key: 5, label: `承制单位性质`, visible: false},
        {key: 6, label: `监管方式`, visible: true},
        {key: 7, label: `发现问题JS代表`, visible: false},
        {key: 8, label: `计划归零时间`, visible: false},
        {key: 9, label: `监管JDB室`, visible: false},
        {key: 10, label: `处理牵头组织单位`, visible: false},
        {key: 11, label: `问题编号`, visible: true},
        {key: 12, label: `问题直接原因类别`, visible: false},
        {key: 13, label: `问题模式`, visible: false},
        {key: 14, label: `承制单位代号`, visible: false},
        {key: 15, label: `承制单位所属部门`, visible: false},
        {key: 16, label: `JDBJJ印章序号`, visible: false},
        {key: 17, label: `发现问题日期`, visible: false},
        {key: 18, label: `监管JDB局`, visible: false},
        {key: 19, label: `问题处理JS代表`, visible: false},
        {key: 20, label: `问题归零情况`, visible: false},
        {key: 21, label: `质量问题级别`, visible: false},
        {key: 22, label: `内外场区别`, visible: false},
        {key: 23, label: `是否拉条挂账`, visible: false},
        {key: 24, label: `是否归零`, visible: false},
        {key: 25, label: `责任人`, visible: false},
        {key: 26, label: `责任单位`, visible: false},
        {key: 27, label: `备注`, visible: true}

      ],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      questionNumbers: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: false,
      // 总条数
      total: 0,
      // 日常质量问题报表格数据
      dailyqualityList: [],
      // 部门树选项
      deptOptions: undefined,
      // 弹出层标题
      title: "",
      title1: "",
      // 是否显示弹出层
      open: false,
      open1: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        issueName: null,
        issueType: null,
        issueDiscovery: null,
        involveProcess: null,
        creditCodes: null,
        contractorUnitNature: null,
        supervisionMethod: null,
        foundProblems: null,
        plannedZeroTime: null,
        representativeOffice: null,
        dealWithOrganization: null,
        problemFactDescription: null,
        causeDetails: null,
        settlementMeasures: null,
        questionNumber: null,
        directCauseCategory: null,
        problemModel: null,
        contractorUnitCode: null,
        contractorDepartment: null,
        representativeOfficeSealNumber: null,
        discoveryDate: null,
        representativeBureau: null,
        problemSolving: null,
        problemZero: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null,
        problemLevel: null,
        differenceFields: null,
        hangAccount: null,
        returnZero: null,
        personLiable: null,
        responsibleUnit: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        issueName: [
          {required: true,message: "问题名称不能为空",trigger: "blur"}
        ],
        foundProblems: [
          {required: true,message: "发现问题JS代表不能为空",trigger: "blur"}
        ],
        questionNumber: [
          {required: true,message: "问题编号不能为空",trigger: "blur"}
        ],
        problemModel: [
          {required: true,message: "问题模式不能为空",trigger: "blur"}
        ],
        issueType: [
          {required: true,message: "问题属性不能为空",trigger: "blur"}
        ],
        directCauseCategory: [
          {required: true,message: "问题直接原因类别不能为空",trigger: "blur"}
        ],
        discoveryDate: [
          {required: true,message: "发现问题日期不能为空",trigger: "blur"}
        ],
        issueDiscovery: [
          {required: true,message: "问题发现方式不能为空",trigger: "blur"}
        ],
        problemSolving: [
          {required: true,message: "问题处理JS代表不能为空",trigger: "blur"}
        ],
        problemFactDescription: [
          {required: true,message: "问题事实描述不能为空",trigger: "blur"}
        ],
        representativeBureau: [
          {required: true,message: "监管JDB局不能为空",trigger: "blur"}
        ],
        representativeOffice: [
          {required: true,message: "监管JDB室不能为空",trigger: "blur"}
        ],
        creditCodes: [
         {required: true,message: "统一社会信用代码不能为空",trigger: "blur"}
       ],
       involveProcess: [
         {required: true,message: "质量体系问题涉及过程不能为空",trigger: "blur"}
       ],
      representativeOfficeSealNumber: [
         {required: true,message: "JDBJJ印章序号不能为空",trigger: "blur"}
      ],
        problemZero: [
          {required: true,message: "问题归零情况不能为空",trigger: "blur"}
       ]
      }
    };
  },

  created() {
    this.getList();
    this.getTreeselect();
  },

  methods: {
    /** 查询部门下拉树结构 */
    getTreeselect() {
      treeselect().then(response => {
        this.deptOptions = response.data;
      });
    },
    /** 查询日常质量问题报列表 */
    getList() {
      this.loading = true;
      listDailyquality(this.queryParams).then(response => {
        this.dailyqualityList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        deptId: null,
        issueName: null,
        issueType: null,
        issueDiscovery: null,
        involveProcess: null,
        creditCodes: null,
        contractorUnitNature: null,
        supervisionMethod: null,
        foundProblems: null,
        plannedZeroTime: null,
        representativeOffice: null,
        dealWithOrganization: null,
        problemFactDescription: null,
        causeDetails: null,
        settlementMeasures: null,
        questionNumber: null,
        directCauseCategory: null,
        problemModel: null,
        contractorUnitCode: null,
        contractorDepartment: null,
        representativeOfficeSealNumber: null,
        discoveryDate: null,
        representativeBureau: null,
        problemSolving: null,
        problemZero: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null,
        problemLevel: null,
        differenceFields: null,
        hangAccount: null,
        returnZero: null,
        personLiable: null,
        responsibleUnit: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.questionNumbers = selection.map(item => item.questionNumber)
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加日常质量问题报表";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getDailyquality(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改日常质量问题报表";
      });
    },
    /** 详情按钮操作 */
    handleView(row) {
     /* const id = row.id || this.ids
      getDailyquality(id).then(response => {
        this.form = response.data;
        this.open1 = true;
        this.title1 = "日常质量问题报详情";
      });*/
      const id = row.id;
      this.$router.push({ path:"/yewu/drdailyqualitydetail", query: {id}});
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateDailyquality(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addDailyquality(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const questionNumbers = row.questionNumber || this.questionNumbers;
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除日常质量问题报问题编号为"' + questionNumbers + '"的数据项？').then(function() {
        return delDailyquality(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('dr/dailyquality/export', {
        ...this.queryParams
      }, `dailyquality_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
